﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Threading;

using RaisingStudio.SmallProgram.Library;

namespace RaisingStudio.SmallProgram.Library.Internal
{
    public static class SmallProgramApplication
    {
        static SmallProgramApplication()
        {
        }


        public static void BeginProgram()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(SmallProgramApplication.HandleException);
        }

        public static void EndProgram()
        {
            // TODO:
        }

        private static void HandleException(object sender, UnhandledExceptionEventArgs e)
        {
            // TODO:
        }

        public static void End()
        {
            // TODO:
        }

        public static string GetEntryAssemblyPath()
        {
            // TODO:
            return null;
        }

        internal static void Invoke(InvokeHelper invokeDelegate)
        {
            invokeDelegate();
        }

        internal static void BeginInvoke(InvokeHelper invokeDelegate)
        {
            (new Thread(delegate()
            {
                invokeDelegate();
            })).Start();
        }


        internal static object InvokeWithReturn(InvokeHelperWithReturn invokeDelegate)
        {
            return invokeDelegate();
        }

        internal static void Initialize()
        {
        }

    }
}

